#include "stdafx.h"
#include "RemindConfig.h"
#include "ui_RemindConfig.h"

#include "BaseInclude.h"

#include <QSettings>

RemindConfig::RemindConfig(QWidget *parent)
	: QWidget(parent)
{
	ui = new Ui::RemindConfig();
	ui->setupUi(this);

	ui->title->setTitleText(tr("Remind Config"));

	pFrameHelper = new FrameHelper(this);
	pFrameHelper->addEdgeWidget(this);
	pFrameHelper->addDragWidget(this);
	pFrameHelper->setMinimizedButton(ui->title->getMinBtn());
	connect(ui->title->getCloseBtn(), SIGNAL(clicked()), this, SLOT(hide()));
	ui->title->getMaxBtn()->setVisible(false);
}

RemindConfig::~RemindConfig()
{
	delete ui;
}

/***********************************************************************************************************************************/
void RemindConfig::setAppBoot(bool startup)
{

#ifdef WIN32
	QSettings reg("HKEY_LOCAL_MACHINE//SOFTWARE//Microsoft""//Windows//CurrentVersion//Run", QSettings::NativeFormat);

	if (startup)
	{
		reg.setValue("Remind", QApplication::applicationFilePath());
	}
	else
	{
		reg.setValue("Remind", "");
	}

#endif

}


/***********************************************************************************************************************************/
void RemindConfig::on_checkBoot_stateChanged(int state)
{
	gMapConfigs["Boot"] = state;
	setAppBoot(state);
	saveConfig(*gSettingConfig);
}

void RemindConfig::on_valueAmi_valueChanged(int value)
{
	gMapConfigs["AniTime"] = value;
	saveConfig(*gSettingConfig);
}

void RemindConfig::on_valueShow_valueChanged(int value)
{
	gMapConfigs["ShowTime"] = value;
	saveConfig(*gSettingConfig);
}



/***********************************************************************************************************************************/




/***********************************************************************************************************************************/
